package ace.module.oss.core.impl.listener;

import ace.module.oss.core.impl.service.OssInitService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * module init event listener.
 *
 * @author Caspar
 */
@Order(1)
@Slf4j
@RequiredArgsConstructor
@Component
public class OssInitListener implements ApplicationListener<ApplicationStartedEvent> {
  private final OssInitService initService;

  @Override
  public void onApplicationEvent(ApplicationStartedEvent event) {
    initService.init();
  }
}
